References to Local Applications
You can specify an application on the local computer with a string of the form"Disk:Folder1:Folder2:...:ApplicationName"
that specifies the application's exact location. If AppleScript can't find the application in that location, it displays a directory dialog box asking where the application is located.You can also specify an application on the local computer with only the application's name (
"ApplicationName"
). In this case, AppleScript attempts to find an application of that name among currently running applications. If the application isn't running, AppleScript attempts to locate it in the current directory. If the application isn't in the current directory, AppleScript displays a directory dialog box asking where the application is located. If the name of the application you select is different from the name specified in the script, the name in the script changes to match the name of the application you select.When you run a script on the same computer on which it was compiled (that is, on which it was last run or saved, or had its syntax checked), AppleScript finds the application you specified in the original script even if you have moved it or changed its name. If the application has been removed, AppleScript searches for another version of the same application.
As with aliases, it is often convenient to store a reference to an application in
a variable:
set x to application "Scriptable Text Editor"x tell x to quitIf you save this script as a script application or compiled script, move the Scriptable Text Editor application to another location, change its name,
then open the script again, the name "Scriptable Text Editor" in
the script changes to reflect the application's new name, and the script still
works correctly.